
module.exports = async (hre) => { 
    const {deployments,ethers} = hre;
    const {deployer} = await getNamedAccounts();
    const factory = await hre.ethers.getContractFactory("NftAuction2");

    const contractV1 = await deployments.get("proxyNftAuction");
    console.log("NftAuctionV1 address:", contractV1.address);

    const proxy = await hre.upgrades.upgradeProxy(contractV1.address, factory);
    await proxy.waitForDeployment();

    const address = await proxy.getAddress();
    console.log("NftAuction proxy address:", address);

    deployments.save("nftAuctionV2",{
        abi: factory.interface.format("json"),
        address:address,
        args: [],
        contract: "NftAuction2",
        from: deployer,
        log:true
    });
}

module.exports.tags = ["nftAuctionV2"];